package com.example.shiyan3;

import android.graphics.drawable.AnimationDrawable;
import androidx.appcompat.app.AppCompatActivity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class frameanimation extends AppCompatActivity {

    private ImageView mImg;
    private AnimationDrawable mAd;
    Button back;
    MediaPlayer mediaPlayer1 = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.frameanimation);
        mImg =  findViewById(R.id.image3);
        mImg.setBackgroundResource(R.drawable.my_frameanimation);
        mAd = (AnimationDrawable) frameanimation.this.mImg.getBackground();
        mAd.start();
        back =  findViewById(R.id.back);
        back.setOnClickListener(this::click);
    }
    public void click(View view){
        mediaPlayer1.stop();
        finish();
    }
}
